#include<bits/stdc++.h>
using namespace std;
int a[100010], n;
bool f[100010];
int main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    sort(a+1, a+n+1);
    int pos = 1, cnt = 0;
    for(int i = 1; i <= n; i++){
        int k = upper_bound(a+1, a+n+1, a[i]) - a;
        if(k > n) break;
        if(k >= pos) pos = k+1;
        else pos++;
        cnt++;
        if(pos > n) break;
    }
    cout << n - cnt << endl;
    return 0;
}